package Actions;
/*
 * Written by Phat Le
 */
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import Model.ProgramChair;
import View.MakeApprovalView;
/**
 * PC makes approval
 * @author Phat
 *
 */
public class MakeApprovalAction extends AbstractAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ProgramChair pc;
	private MakeApprovalView makeAppr;
	private JTable table;
	
	public MakeApprovalAction(final JTable a_table, final ProgramChair a_pc) {
		table = a_table;
		pc = a_pc;
		this.putValue(NAME, "Make Approval");
		this.putValue(MNEMONIC_KEY, KeyEvent.VK_R);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(table.getSelectedRow()!= -1){
			makeAppr = new MakeApprovalView(table, pc);
			makeAppr.start();
			makeAppr.updateLabels();
			table.repaint();
		} else {
			JOptionPane.showMessageDialog(null, "Please choose a manuscript to make approval");
		}
	}

}

